{% extends "base.html" %}

{% block title %}语音合成{% endblock %}

{% block sidebar %}
<div class="list-group">
    <a href="{{ url_for('audio_monitor') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'audio_monitor' %}active{% endif %}"><i class="bi bi-mic"></i> 声音监控</a>
    <a href="{{ url_for('audio_wake') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'audio_wake' %}active{% endif %}"><i class="bi bi-mic-fill"></i> 语音唤醒</a>
    <a href="{{ url_for('audio_tts') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'audio_tts' %}active{% endif %}"><i class="bi bi-chat-text"></i> 语音合成</a>
    <a href="{{ url_for('audio_test') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'audio_test' %}active{% endif %}"><i class="bi bi-volume-up"></i> 播放测试</a>
    <a href="{{ url_for('audio_speak_test') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'audio_speak_test' %}active{% endif %}"><i class="bi bi-mic"></i> 语音识别</a>
</div>
{% endblock %}

{% block content %}
<div class="container-fluid px-2">
    <div class="row">
        {# <div class="col-md-3">
            <!-- 可放置设置或说明 -->
        </div> #}
        <div class="col-md-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="mb-0">语音合成</h4>
                </div>
                <div class="card-body">
                    <form id="ttsForm">
                        <div class="form-group">
                            <label for="textInput">输入要转换的文字：</label>
                            <textarea class="form-control" id="textInput" rows="5" placeholder="请输入要转换的文字..."></textarea>
                        </div>
                        <div class="d-grid gap-2 mt-3">
                            <button class="btn btn-primary" onclick="synthesize()">
                                <i class="bi bi-play-circle"></i> 开始合成
                            </button>
                            <button class="btn btn-success" onclick="saveAudio()">
                                <i class="bi bi-download"></i> 保存音频
                            </button>
                        </div>
                    </form>
                </div>
            </div>
            <!-- 其他内容可继续放在此处 -->
        </div>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script>
function synthesize() {
    const text = document.getElementById('textInput').value;
    if (!text) {
        alert('请输入要转换的文字');
        return;
    }
    // 实现语音合成功能
}

function saveAudio() {
    // 实现音频保存功能
}

function loadSynthesisHistory() {
    // 加载合成历史
}

// 页面加载完成后执行
document.addEventListener('DOMContentLoaded', function() {
    loadSynthesisHistory();
});
</script>
{% endblock %} 